﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using HK2009.BusinessFacade;
using HK2009.EntityManage;
using HK2009.Common;
using HK2009.EntityQuery;

namespace HK2009.BusinessFacadeHandler
{
    public class SyMarketHandler : ISyMarketHandler
    {
        DataBase db = new DataBase();
        Sy_MarketManage manager = new Sy_MarketManage();

        /// <summary>
        /// 根据sql语句同参数获取市场资料列表
        /// </summary>
        /// <param name="sqlStr"></param>
        /// <param name="parms"></param>
        /// <returns></returns>
        public DataTable GetList(string sqlStr, SqlParameter[] parms)
        {
            return db.RunSqlTab(sqlStr, parms);
        }

        /// <summary>
        /// 获取所有市场信息
        /// </summary>
        /// <returns></returns>
        public DataTable GetList()
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0] = new SqlParameter("@Status","1");
           return manager.GetSy_MarketList(" Status=@Status",parms);
        }

        /// <summary>
        /// 根据ID删除记录
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public bool DeleteByID(int pkid)
        {
            return manager.DeleteSy_Market(pkid);
        }


        /// <summary>
        /// 根据ID获取市场信息
        /// </summary>
        /// <param name="pkid"></param>
        /// <returns></returns>
        public Sy_MarketQuery GetMarketByID(int pkid)
        {
            return manager.GetSy_MarketQuery(pkid);
        }


        /// <summary>
        ///  更改市场资料
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public bool UpdateMarket(Sy_MarketQuery query)
        {
            return manager.UpdateSy_Market(query);
        }


        /// <summary>
        /// 添加市场资料
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public bool AddMarket(Sy_MarketQuery query)
        {
            return manager.InsertSy_Market(query);
        }
    }
}